<html>
    <head>
        <title>Graph Store Protocol Tests</title>
    </head>
    <body>
        <h1>Graph Store Protocol Tests</h1>
        
        <ul>
            <li>
                Tests
                <ol>
                    <li><a href='#put__initial_state'>PUT - Initial state</a></li>
                    <li><a href='#get_of_put__initial_state'>GET of PUT - Initial state</a></li>
                    <li><a href='#put__graph_already_in_store'>PUT - graph already in store</a></li>
                    <li><a href='#get_of_put__graph_already_in_store'>GET of PUT - graph already in store</a></li>
                    <li><a href='#put__default_graph'>PUT - default graph</a></li>
                    <li><a href='#get_of_put__default_graph'>GET of PUT - default graph</a></li>
                    <li><a href='#put__mismatched_payload'>PUT - mismatched payload</a></li>
                    <li><a href='#put__empty_graph'>PUT - empty graph</a></li>
                    <li><a href='#get_of_put__empty_graph'>GET of PUT - empty graph</a></li>
                    <li><a href='#delete__existing_graph'>DELETE - existing graph</a></li>
                    <li><a href='#get_of_delete__existing_graph'>GET of DELETE - existing graph</a></li>
                    <li><a href='#delete__nonexistent_graph'>DELETE - non-existent graph</a></li>
                    <li><a href='#post__existing_graph'>POST - existing graph</a></li>
                    <li><a href='#get_of_post__existing_graph'>GET of POST - existing graph</a></li>
                    <li><a href='#post__multipart/formdata'>POST - multipart/form-data</a></li>
                    <li><a href='#get_of_post__multipart_formdata'>GET of POST - multipart/form-data</a></li>
                    <li><a href='#post__create__new_graph'>POST - create  new graph</a></li>
                    <li><a href='#get_of_post__create__new_graph'>GET of POST - create  new graph</a></li>
                    <li><a href='#post__empty_graph_to_existing_graph'>POST - empty graph to existing graph</a></li>
                    <li><a href='#get_of_post__after_noop'>GET of POST - after noop</a></li>
                    <li><a href='#head_on_an_existing_graph'>HEAD on an existing graph</a></li>
                    <li><a href='#head_on_a_nonexisting_graph'>HEAD on a non-existing graph</a></li>                    
                </ol>
            </li>
        </ul>
        
        <p><strong>$HOST$</strong> is the host where the Graph Store Protocol implementation is listening</p>
        <p><strong>$GRAPHSTORE$</strong> is the path of the URL of the graph store</p>
        <p><strong>$NEWPATH$</strong> is the URL returned in the Location HTTP header</p>

        <p>HTTP response messages are in the format:</p>

        <pre>
            HTTP Status code
            Headers
            &lt;space>
            Body                    
        </pre>
        
        <h2 id='put__initial_state'>PUT - Initial state</h2>
        <h3>Request</h3>
        <pre>
PUT $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$
Content-Type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

&lt;http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
    foaf:businessCard [ 
        a v:VCard;
        v:fn "John Doe" 
    ].            
        </pre>
        <h3>Response</h3>
        <pre>
201 Created            
        </pre>

        <h2 id='get_of_put__initial_state'>GET of PUT - Initial state</h2>
        <h3>Request</h3>
        <pre>
GET $GRAPHSTORE$?graph=$GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$
Accept: text/turtle; charset=utf-8

        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8

&lt;http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
   foaf:businessCard [ 
        a v:VCard;
        v:fn "John Doe" 
   ].
        </pre>
        
        <h2 id='put__graph_already_in_store'>PUT - graph already in store</h2>
        <h3>Request</h3>
        <pre>
PUT $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$
Content-Type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

&lt;http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
    foaf:businessCard [ 
        a v:VCard;
        v:fn "Jane Doe" 
    ].
        </pre>
        <h3>Response</h3>
        <pre>
204 No Content
        </pre>

        <h2 id='get_of_put__graph_already_in_store'>GET of PUT - graph already in store</h2>
        <h3>Request</h3>
        <pre>
GET $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$
Accept: text/turtle; charset=utf-8

        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

&lt;http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
   foaf:businessCard [ 
        a v:VCard;
        v:fn "Jane Doe" 
   ] .
        </pre>

        <h2 id='put__default_graph'>PUT - default graph</h2>
        <h3>Request</h3>
        <pre>
PUT $GRAPHSTORE$?default HTTP/1.1
Host: $HOST$
Content-Type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

[]  a foaf:Person;
    foaf:businessCard [ 
        a v:VCard;
        v:given-name "Alice" 
    ] .
        </pre>
        <h3>Response</h3>
        <pre>
204 No Content
        </pre>

        <h2 id='get_of_put__default_graph'>GET of PUT - default graph</h2>
        <h3>Request</h3>
        <pre>
GET $GRAPHSTORE$?default HTTP/1.1
Host: $HOST$
Accept: text/turtle; charset=utf-8   
         
        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

[]  a foaf:Person;
    foaf:businessCard [ 
        a v:VCard;
        v:given-name "Alice" 
    ] .            
        </pre>

        <h2 id='put__mismatched_payload'>PUT - mismatched payload</h2>
        <h3>Request</h3>
        <pre>
PUT $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$
Content-Type: application/rdf+xml

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

&lt;http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
    foaf:businessCard [ 
        a v:VCard;
        v:fn "Jane Doe" 
    ].            
        </pre>
        <h3>Response</h3>
        <pre>
400 Bad Request            
        </pre>
        
        <h2 id='put__empty_graph'>PUT - empty graph</h2>
        <h3>Request</h3>
        <pre>
PUT $GRAPHSTORE$?graph=$GRAPHSTORE$/person/2.ttl HTTP/1.1
Host: $HOST$
Content-Type: text/turtle; charset=utf-8         
   
        </pre>
        <h3>Response</h3>
        <pre>
200 OK            
        </pre>
        
        <h2 id='get_of_put__empty_graph'>GET of PUT - empty graph</h2>
        <h3>Request</h3>
        <pre>
GET $GRAPHSTORE$/person/2.ttl HTTP/1.1
Host: $HOST$
Accept: text/turtle; charset=utf-8            

        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8            

        </pre>

        <h2 id='delete__existing_graph'>DELETE - existing graph</h2>
        <h3>Request</h3>
        <pre>
DELETE $GRAPHSTORE$/person/2.ttl HTTP/1.1
Host: $HOST$            

        </pre>
        <h3>Response</h3>
        <pre>
200 OK            
        </pre>

        <h2 id='get_of_delete__existing_graph'>GET of DELETE - existing graph</h2>
        <h3>Request</h3>
        <pre>
GET $GRAPHSTORE$/person/2.ttl HTTP/1.1
Host: $HOST$            

        </pre>
        <h3>Response</h3>
        <pre>
404 Not Found            
        </pre>

        <h2 id='delete__nonexistent_graph'>DELETE - non-existent graph</h2>
        <h3>Request</h3>
        <pre>
DELETE $GRAPHSTORE$/person/2.ttl HTTP/1.1
Host: $HOST$            

        </pre>
        <h3>Response</h3>
        <pre>
404 Not Found            
        </pre>

        <h2 id='post__existing_graph'>POST - existing graph</h2>
        <h3>Request</h3>
        <pre>
POST $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$
Content-Type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .

&lt;http://$HOST$/$GRAPHSTORE$/person/1> foaf:name "Jane Doe"            
        </pre>
        <h3>Response</h3>
        <pre>
200 OK            
        </pre>

        <h2 id='get_of_post__existing_graph'>GET of POST - existing graph</h2>
        <h3>Request</h3>
        <pre>
GET $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$
Accept: text/turtle; charset=utf-8 
           
        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

&lt;http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
    foaf:name "Jane Doe";
    foaf:businessCard [ 
        a v:VCard;
        v:fn "Jane Doe" 
    ] .            
        </pre>

        <h2 id='post__multipart/formdata'>POST - multipart/form-data</h2>
        <h3>Request</h3>
        <pre>
POST $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$
Content-type: multipart/form-data; boundary=AaB03x

--AaB03x
content-disposition: form-data; name="graphs"
Content-type: multipart/mixed; boundary=BbC04y

--BbC04y
Content-disposition: attachment; filename="lastName.ttl"
Content-type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
&lt;http://$HOST$/$GRAPHSTORE$/person/1> foaf:familyName "Doe" 
--BbC04y
Content-disposition: attachment; filename="firstName.ttl"
Content-type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
&lt;http://$HOST$/$GRAPHSTORE$/person/1> foaf:givenName  "Jane"
--BbC04y
--AaB03x            
        </pre>
        <h3>Response</h3>
        <pre>
200 OK            
        </pre>

        <h2 id='get_of_post__multipart_formdata'>GET of POST - multipart/form-data</h2>
        <h3>Request</h3>
        <pre>
GET $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$         
   
        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

&lt;http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
    foaf:name           "Jane Doe";
    foaf:givenName      "Jane";
    foaf:familyName     "Doe";
    foaf:businessCard [ 
        a               v:VCard;
        v:fn            "Jane Doe" 
    ] .
        </pre>

        <h2 id='post__create__new_graph'>POST - create  new graph</h2>
        <h3>Request</h3>
        <pre>
POST $GRAPHSTORE$ HTTP/1.1
Host: $HOST$
Content-Type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

[]  a foaf:Person;
    foaf:businessCard [ 
        a v:VCard;
        v:given-name "Alice" 
    ] .            
        </pre>
        <h3>Response</h3>
        <pre>
201 Created
Location: $NEWPATH$

        </pre>

        <h2 id='get_of_post__create__new_graph'>GET of POST - create  new graph</h2>
        <h3>Request</h3>
        <pre>
GET $NEWPATH$ HTTP/1.1
Host: $HOST$
Accept: text/turtle; charset=utf-8    
        
        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

[]  a foaf:Person;
    foaf:businessCard [ 
        a v:VCard;
        v:given-name "Alice" 
    ] .         
        </pre>

        <h2 id='post__empty_graph_to_existing_graph'>POST - empty graph to existing graph</h2>
        <h3>Request</h3>
        <pre>
POST $NEWPATH$ HTTP/1.1
Host: $HOST$
Content-Type: text/turtle; charset=utf-8       
     
        </pre>
        <h3>Response</h3>
        <pre>
204 No Content            
        </pre>

        <h2 id='get_of_post__after_noop'>GET of POST - after noop</h2>
        <h3>Request</h3>
        <pre>
GET $NEWPATH$ HTTP/1.1
Host: $HOST$
Accept: text/turtle; charset=utf-8   
         
        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8

@prefix foaf: &lt;http://xmlns.com/foaf/0.1/> .
@prefix v: &lt;http://www.w3.org/2006/vcard/ns#> .

[]  a foaf:Person;
    foaf:businessCard [ 
        a v:VCard;
        v:given-name "Alice" 
    ] .            
        </pre>

        <h2 id='head_on_an_existing_graph'>HEAD on an existing graph</h2>
        <h3>Request</h3>
        <pre>
HEAD $GRAPHSTORE$/person/1.ttl HTTP/1.1
Host: $HOST$

        </pre>
        <h3>Response</h3>
        <pre>
200 OK
Content-type: text/turtle; charset=utf-8       
                 
        </pre>

        <h2 id='head_on_a_nonexisting_graph'>HEAD on a non-existing graph</h2>
        <h3>Request</h3>
        <pre>
HEAD $GRAPHSTORE$/person/2.ttl HTTP/1.1
Host: $HOST$

        </pre>
        <h3>Response</h3>
        <pre>
404 Not Found                        
        </pre> 
    </body>
</html>